#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>

struct stu
{
	char name[20];
	int age;
};
int sort_name(void* e1, void* e2)
{
	return strcmp(((struct stu*)e1)->name, ((struct stu*)e2)->name);
}
int sort_age(void* e1, void* e2)
{
	return ((struct stu*)e1)->age - ((struct stu*)e2)->age;
}
int main()
{

	struct stu s[] = { {"zhangsan",50},{"lisi",34},{"wangwu",20} };
	int sz = sizeof(s) / sizeof(s[1]);

	//qsort(s, sz, sizeof(s[0]), sort_name);
    qsort(s, sz, sizeof(s[0]), sort_age);
	
	return 0;
}